{% extends 'layout/base.html' %}
{% load static %}
{% block content %}
    <br>
    <br>
    <br>
    <br>
    <div class="container-fluid col-lg-5 col-lg-offset-3" style="">
        <div class="row col-lg-5 col-lg-offset-3">
            <div class="row ">
                {{ err_msg }}
                <p class="text-center">为保障帐号({{user.wechat_code}})安全，请用微信扫码验证身份</p>
            </div>

             <img src="{% url 'spiders_account:show_img'  user.id  %}" alt="" class="img-rounded img-responsive  center-block ">
            <br>
            <div class="row">
                <p class="text-center">管理员与运营者微信号：可直接扫码登录 <br>
                其他微信号：扫码后需联系管理员:{{ user.scaner }}({{ user.adminer_wechat_id }})验证登录</p>
            </div>
        </div>
    </div>
{% endblock %}
{% block js %}
    <script>
        $(function () {
            checkLogin()
        });
        function checkLogin() {
            $.ajax({
                url:"{% url 'spiders_account:check_login' %}",
                type:"GET",
                data:{username:"{{ user.wechat_code }}"},
                success: function (result) {
                    console.log(result);
                    if(result.status){
                        alert("登陆成功");
                        location.href = result.hrefs
                    }else {
                        checkLogin();
                    }
                }
            })
        }
    </script>
{% endblock %}